package com.project.service;

import com.project.dao.ShortAnswerMapper;
import com.project.entity.ShortAnswer;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional(rollbackFor = Exception.class)
@Service
public class ShortAnswerServiceImpl extends BaseService implements ShortAnswerService {

    @Autowired
    ShortAnswerMapper shortAnswerMapper;

    @Override
    public void add(ShortAnswer shortAnswer) {
        shortAnswerMapper.insertSelective(shortAnswer);
    }

    @Override
    public ShortAnswer findByExcerciseInfoId(Integer exerciseinfoid) {
        return shortAnswerMapper.selectByExerciseInfoId(exerciseinfoid);
    }

    @Override
    public int modify(ShortAnswer shortAnswer)
    {
        return shortAnswerMapper.updateByPrimaryKeySelective(shortAnswer);
    }
}
